package models

import "gorm.io/gorm"

// 用户表
type User struct {
	gorm.Model
	Phone        string `gorm:"type:varchar(11);unique;comment:'手机号'"`
	NickName     string `gorm:"type:varchar(20);comment:'昵称'"`
	AvatarUrl    string `gorm:"type:varchar(500);comment:'头像 URL'"`
	Region       string `gorm:"type:varchar(11);comment:'地区'"`
	Introduction string `gorm:"type:varchar(50);comment:'简介'"`
}

// 内容表
type Content struct {
	gorm.Model
	UserId       int    `gorm:"type:int(20);comment:'用户Id'"`
	Title        string `gorm:"type:varchar(50);comment:'标题'"`
	Details      string `gorm:"type:varchar(50);comment:'内容详情'"`
	CoverUrl     string `gorm:"type:varchar(50);comment:'封面图'"`
	CategoryTag  string `gorm:"type:varchar(50);comment:'分类标签'"`
	ViewCount    int    `gorm:"type:int(20);comment:'浏览量'"`
	LikeCount    int    `gorm:"type:int(20);comment:'点赞量'"`
	CollectCount int    `gorm:"type:int(20);comment:'收藏量'"`
}

// 关注表
type Follow struct {
	FollowId   int `gorm:"type:int(20);comment:'关注者'"`
	FollowedID int `gorm:"type:int(20);comment:'被关注者'"`
	Status     int `gorm:"type:int(20);comment:'0-取消关注,1-已关注'"`
}

// 评论表
type Comment struct {
	gorm.Model
	ContentId int    `gorm:"type:int(20);unique;comment:'内容 ID'"`
	UserId    int    `gorm:"type:int(20);comment:'用户 ID'"`
	Content   string `gorm:"type:varchar(50);comment:'评论内容'"`
	LikeCount int    `gorm:"type:int(20);comment:'点赞量'"`
}

// 互动行为表
type Interaction struct {
	gorm.Model
	ContentId int `gorm:"type:int(20);unique;comment:'内容 ID'"`
	UserId    int `gorm:"type:int(20);unique;comment:'用户 ID'"`
	Type      int `gorm:"type:int(20);comment:'0-点赞,1-收藏'"`
}

// 消息表
type Message struct {
	gorm.Model
	UserId string `gorm:"type:varchar(50);comment:'消费者'"`
	SendId string `gorm:"type:varchar(50);comment:'发送者'"`
	Data   string `gorm:"type:varchar(200);comment:'内容'"`
}

// 搜索记录表
type SearchRecord struct {
	gorm.Model
	UserId      int    `gorm:"type:int(20);unique;comment:'用户 ID'"`
	Keyword     string `gorm:"type:varchar(200);comment:'搜索关键词'"`
	ResultCount int    `gorm:"type:int(20);comment:'搜索结果数量'"`
}
